
main() {
  var list = [1,2,3,4,5,6,7,8];
  var range = list.getRange(0, list.length);
  bool findWhere(int element)=> element>3;
  print( range.firstWhere(findWhere,orElse: ()=>100));
}

class MyClass {
  String _name;
  int age;
  String isCanReg;
  MyClass(this._name,{this.age = 0,this.isCanReg =""}){
   print("构造方法调用");
  }
  MyClass.getDemo(this._name,this.age,this.isCanReg);
  MyClass.createMyClass(String name,int ageNumber):this(name,age:ageNumber);
  int sumUpToFive(int a, {int? b, int? c, int? d, String e = "1"}) {
    int sum = 0;
    if(e=="1"){
      sum =  a + (b ?? 0) + (c ?? 0) + (d ?? 0);
    }else{
      sum =  a * (b ?? 0) * (c ?? 0) * (d ?? 0);
    }
    return sum;
  }

  void printName(String firstName,String lastName,{ String suffix = '',String difference = ""}){
    print(firstName);
    print(lastName);
    print(suffix);
  }
  void printStudentName({String? firstName,Set<String>? nameList}){
    print(firstName??"开始签名");
    nameList?.forEach((element) {
      print(element);
    });
}
  void throwException(){
    throw const OutOfMemoryError();
    throw Exception("Something bad happened");
  }
}
